﻿using BasicData.API.Read.Application.Commands;
using BasicData.Domain;
using BasicData.ErrorCode;
using BasicData.Infrastructure.interfaces;
using MediatR;

namespace BasicData.API.Read.Application.CommandHandlers
{
  
    public class GetCangCommandHandler : IRequestHandler<GetCangCommand, APIResult<List<CangModel>>>
    {
        private readonly IBaseRepository<CangModel> baseRepository;

        public GetCangCommandHandler(IBaseRepository<CangModel> baseRepository)
        {
            this.baseRepository = baseRepository;
        }

        public async Task<APIResult<List<CangModel>>> Handle(GetCangCommand request, CancellationToken cancellationToken)
        {
            var list = baseRepository.GetAll();



            return APIResult<List<CangModel>>.Success("显示成功", list.ToList());
        }
    }
}
